//
//  YGConsultView.m
//  yuanshangyiliao
//
//  Created by icholab on 2021/3/22.
//

#import "YGConsultView.h"

@interface YGConsultView ()


@property (nonatomic, strong)UILabel *consultLable;
@property(nonatomic, strong)UIImageView *consultImage;


@end

@implementation YGConsultView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self initView];
        [self initContraints];
    }
    return self;
}

- (void)initView{
    
    [self addSubview:self.consultBtn];
    [self addSubview:self.consultLable];
    [self addSubview:self.consultImage];
}


- (void)initContraints{
    
    [self.consultBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.mas_top);
        make.left.mas_equalTo(self.mas_left);
        make.width.mas_equalTo(self.mas_width);
        make.height.mas_equalTo(self.mas_height);
    }];
    
    [self.consultLable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.mas_top).offset(15);
            make.left.mas_equalTo(self.mas_left).offset(10);
            make.width.mas_equalTo(100);
            make.height.mas_equalTo(16);
            
    }];
    
    [self.consultImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self.mas_centerY);
            make.right.mas_equalTo(self.mas_right).offset(-20);
            make.height.mas_equalTo(88);
        make.width.mas_equalTo(53.5);
            
    }];
}
#pragma delegate - 跳转页面
-(void)clickInfoConsultAction{
    if (self.consultViewDelegate != nil && [self.consultViewDelegate respondsToSelector:@selector(consultViewInfoConsultControllerAction)]) {
        [self.consultViewDelegate consultViewInfoConsultControllerAction];
    }
}


#pragma setter

- (UIButton *)consultBtn{
    if (!_consultBtn) {
        _consultBtn=[[UIButton alloc]init];
        _consultBtn.backgroundColor=UIColorFromRGB(0xD8E5FF);
        _consultBtn.layer.cornerRadius=5;
        [_consultBtn addTarget:self action:@selector(clickInfoConsultAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _consultBtn;
}

- (UILabel *)consultLable{
    if (!_consultLable) {
        _consultLable=[[UILabel alloc]init];
        _consultLable.text=@"咨询问诊";
        _consultLable.textColor=UIColorFromRGB(0x617FBC);
        _consultLable.font=[UIFont fontWithName:@"Helvetica-Bold" size:16];
        
    }
    return _consultLable;
}

- (UIImageView *)consultImage{
    if (!_consultImage) {
        _consultImage= [[UIImageView alloc]init];
        [_consultImage setImage:[UIImage imageNamed:@"consult_doc_icon"]];
    }
    return _consultImage;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
